package cn.cloud.butler.uploadapi.repository;

import cn.cloud.butler.uploadapi.domain.StateDayEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by zhouguocheng on 2018-12-27-上午 10:38
 */
public interface StateDayRepository extends JpaRepository<StateDayEntity,Integer> {

    //@Cacheable(value = "findByMacsn-macsn")
    StateDayEntity findByMacsn(String macsn);
    //List<StateDayEntity> findByMacsnAndUploadTimeBetween(String macsn, String start, String end);
    @Query(value="select * from OperState where MacSN = ?1 and UploadTime <= ?3 and UploadTime >= ?2 and (ISNULL(Descr) || Descr<>?4)", nativeQuery = true)
    List<StateDayEntity> selNoqrRegionStateByMacSn(String macSn, String start, String end, String qrflag);
}
